package thread.communication;
import static java.lang.System.out;

public class Waiting_on_Class_Instance implements Runnable{
	static int[] array = new int[30];
	
	public static void main(String[] args) {
		Waiting_on_Class_Instance me = new Waiting_on_Class_Instance();
		
		(new Thread(me)).start();
		
		synchronized (me) {
			try {
				me.wait();
			} catch (InterruptedException e) {
				out.println(e.toString());
			}
		}
		print();
	}
	
	@Override
    public void run() {
		synchronized(this){
			for (int j = 0; j < 30; j++){
				array[j] = j;
			}
			
			this.notify();
		}
    }
	
	static void print() {
		for (int i : array) {
			out.print(i + ",");
		}
		out.print("\n");
	}
}

// 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
